package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.pojo.Setmeal;
import com.itheima.vo.SetmealVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author jshstart
 * @creat 2020-11-13 17:42
 */
public interface SetmealMapper extends BaseMapper<Setmeal> {
    @Select("select * from t_setmeal where id=#{id}")
    SetmealVo findAllSetmeal(Long id);

    @Select("select * from t_setmeal where is_delete=0 and id=#{id}")
    Setmeal findAllById(Long id);

    @Select("select s.name ,count(o.member_id) as setmeal_count ,s.remark as remark from t_order o\n" +
            "left join t_setmeal s on s.id=o.setmeal_id group by s.id\n" +
            "order by setmeal_count desc limit 5")
    List<Map> findHotSetmeal();
}
